package emulator.support;

import emulator.hardware.HwByte;
import emulator.util.MemoryPtr;

public class ZeroPageXOperandEval implements OperandEval {

	MemoryPtr instruction;

	public ZeroPageXOperandEval(MemoryPtr ptr) {
		instruction = ptr;
	}

	@Override
	public String getDetails(CpuState cpu_state) {
		int reg_x = cpu_state.getValue("X");
		int operand = instruction.getByteOp();
		instruction.setAddress((operand+reg_x) & 0xff);
		return "($" + new HwByte(operand) + " + $" + new HwByte(reg_x) + ") -> $" + new HwByte(instruction.getByteOp());
	}

}
